package 工厂模式;



public class TestMain {
	public static void main(String[] args) {

	}
	public static  void test0(){
		Sender sender = null;
		try {
			sender = SenderFactory.produce(SenderType.SMS);
			sender.send("SMS");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	public static void testFactory(){
		Provider provider = new SmsFactory();
		Sender sender = provider.produce();
		sender.send("短信"); // 发送短信
	}
	public static void test1 (){
		Provider provider = new EmailFactory();
		Sender sender = provider.produce();
		sender.send("邮件"); // 发送邮件
	}

	public static void test2(){
		Provider provider = new ExpressFactory();
		Sender sender = provider.produce();
		sender.send("快递"); // 发送快递
	}
}
